<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
       <div>
           <span>数字A</span>
           <input type="text"  v-model.number.trim='a'>

       </div> 
       <div>
        <span>数字B</span>
        <input type="text"  v-model.number.trim='b'>
        
    </div> 
    <button  @click='add'>点击计算</button>
    <div> 结果：  {{c}}  </div>
     
    </div>
    <script src="./vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                a:0,
                b:0,
                c:0
            },
            methods: {

                add() {
                    // console.log(typeof (this.a));
                    // this.c=Number(this.a)+Number(this.b)

                    this.c=this.a+this.b
                }
            }
        });
    </script>
</body>

</html>